package com.example.ass7.dataloader;

import java.util.List;

import com.example.ass7.geometryprimitives.Point;
import com.example.ass7.sprite.Block;

/**
 * @author Meirav Ben Izhak
 */
public class BlockCreatorImpl implements BlockCreator {

    private final double height;
    private final double width;
    private final int hitPoints;
    private final Background defaultFillColors;
    private final List<Background> fillColors;
    private final Background strokeColor;

    /**
     * @param height
     *            height
     * @param width
     *            width
     * @param hitPoints
     *            hitPoints
     * @param defaultFillColors
     *            defaultFillColors
     * @param fillColors
     *            fillColors
     * @param strokeColor
     *            strokeColor
     */
    public BlockCreatorImpl(
        double height, double width, int hitPoints,
        Background defaultFillColors, List<Background> fillColors,
        Background strokeColor) {

        this.height = height;
        this.width = width;
        this.hitPoints = hitPoints;
        this.defaultFillColors = defaultFillColors;
        this.fillColors = fillColors;
        this.strokeColor = strokeColor;
    }

    @Override
    public Block create(int xpos,
            int ypos) {
        Block block = new Block(new Point(xpos, ypos), this.width, this.height,
                this.defaultFillColors);
        block.setHitPoints(this.hitPoints);
        block.setFillColors(this.fillColors);
        block.setStrokeColor(this.strokeColor);
        block.setOriginalHitPoints(this.hitPoints);
        return block;
    }
}
